﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Newtonsoft.Json;

using System.Web.Services;

namespace Guide
{
    public partial class Json : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        //[System.Web.Services.WebMethod()] 
        //不带参数
        [WebMethod]
        public static string getValueByAjaxNoParms()
        {
            string ddd = "返回 GAGAHJT";
            return ddd.ToString();
        }

        [WebMethod]
        public static string getAObject(string no)
        {
            //List<Province> list = Province.getProvice();
            //string value=JsonConvert.SerializeObject(list);
            Dictionary<string, string> dInfo = new Dictionary<string, string>();
            dInfo.Add("EnglishName", "William");
            dInfo.Add("ChinaName", "WangJiBin");
            string json = JsonConvert.SerializeObject(dInfo);
            //string json = "Hello World"+no;
            return json;
        }

        [WebMethod]
        public static string getJson()
        {
            Dictionary<string, string> dInfo = new Dictionary<string, string>();
            dInfo.Add("EnglishName", "William");
            dInfo.Add("ChinaName", "WangJiBin");
            string json = JsonConvert.SerializeObject(dInfo);
            return json;
        }

        [WebMethod]
        public static string getJsonWithParams(string key,string value)
        {
            Dictionary<string, string> dInfo = new Dictionary<string, string>();
            dInfo.Add("EnglishName", "William");
            dInfo.Add("ChinaName", "WangJiBin");
            dInfo.Add(key, value);
            string json = JsonConvert.SerializeObject(dInfo);
            return json;
        }
    }


}